package com.zf.tjlis;

import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.DriverManager;
import java.sql.SQLException;

/**
 * 
 * @ClassName: DBMetaData
 * @Description: DBMetaData
 * @Author Victor victorwang@ecomsh.com.cn
 * @Date 2016/06/15 AM 9:00:00
 * 
 */
public class MSSqlDBMetaData {

    public MSSqlDBMetaData() {
    }

    /**
     * 
     * @param url
     * @param user
     * @param password
     */
    public Connection getConnection(String url, String user, String password) {
        Connection connect = null;
        try {
            Class.forName("oracle.jdbc.OracleDriver");
            connect = DriverManager.getConnection(url, user, password);
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return connect;
    }
    
    /**
     * 
     * @param connect
     */
    public DatabaseMetaData getDBMetaData(Connection connect) {
        DatabaseMetaData dbMetaData = null;
        try {
            dbMetaData = connect.getMetaData();
        } catch (SQLException e) {
            e.printStackTrace();
        }

        return dbMetaData;
    }

    /**
     */
    public void colseConnct(Connection connect) {
        try {
            if (connect != null) {
                connect.close();
            }
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }
}
